package com.tmt.paymentcenter.web.configure.bean;

import org.springframework.data.auditing.DateTimeProvider;

import java.util.Calendar;

/**
 * Created by ThreeManTeam on 2017/6/14.
 */
public class AuditingDateTimeProvider implements DateTimeProvider {

    private final DateTimeService dateTimeService;

    public AuditingDateTimeProvider(DateTimeService dateTimeService) {
        this.dateTimeService = dateTimeService;
    }

    @Override
    public Calendar getNow() {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(dateTimeService.getCurrentDateAndTime());
        return calendar;
    }
}
